package com.trip;

import com.trip.def.CommonDefines;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

/**
 * Created by hc24 on 2017/9/27.
 */
@EnableScheduling
@ServletComponentScan
@SpringBootApplication
public class Bootstrap extends SpringBootServletInitializer{
    public static void main(String[] args) {
        SpringApplication.run(Bootstrap.class,args);
    }


    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Bootstrap.class);
    }

    @Override
    public void onStartup(ServletContext servletContext) throws ServletException {
        super.onStartup(servletContext);
        servletContext.setAttribute(CommonDefines.SC_ATTR_CTX, servletContext.getContextPath());
    }
}
